package com.aube.mis.util;

import java.io.InputStream;
import java.util.List;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ConfigProperty {

	private static Logger log = LoggerFactory.getLogger(ConfigProperty.class);
	
	public static Properties props = new Properties();
	
	public static List<String> propList;
	
	public static String getProperties(String key){
		return ConfigProperty.props.getProperty(key);
	}
	
	private static void init(){
		InputStream is = null;
		for (String resource : propList){
			is = ConfigProperty.class.getResourceAsStream("/META-INF/" + resource);
			log.info("loading properties: " + resource);
			try{
				props.load(is);
			}catch(Throwable t){
				log.error("loading " + resource + " cause error",t);
			}
		}
	}

	public List<String> getPropList() {
		return propList;
	}

	public void setPropList(List<String> propList) {
		this.propList = propList;
	}
}
